package com.albert.java_log4j_demo;

import cn.hutool.core.date.BetweenFormatter;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;

import java.util.Date;

/**
 * @author 陈晖
 * @version 1.0
 * @date 2021/10/11 10:40
 */
public class TimeCaculate {
    public static void main(String[] args) {

        String dateStr1 = "2021-10-10 09:33:23";
        Date date1 = DateUtil.parse(dateStr1);

        String dateStr2 = "2021-10-11 18:37:23";
        Date date2 = DateUtil.parse(dateStr2);

        String formatBetween = DateUtil.formatBetween(date1,date2, BetweenFormatter.Level.SECOND);
        System.out.println(formatBetween);

    }
}
